<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:param name="cgi_href"/>
    <xsl:param name="html_href"/>
    <xsl:output method="html"/>

    <xsl:template match="/">
        <html>
            <head>
                <link href="{$html_href}/static/css/ep_tools_ui.css" rel="stylesheet" type="text/css"/>
                <link href="{$html_href}/static/css/stylesheet.css" rel="stylesheet" type="text/css"/>
                <script src="{$html_href}/static/js/ep_ui.js"></script>
            </head>
            <body bgcolor="#FFFFFF" style="margin: 0px">
                <div id="slog" style="width: 100%; height: 100%; position: absolute; overflow: auto;">
                    <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td colspan="2" width="100%">
                                <table class="mainTool" width="100%" border="0" cellpadding="3" cellspacing="0">
                                    <tr height="24">
                                        <td width="100%"><span style="font-weight: bold;">Session Log</span></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <xsl:apply-templates>
                            <xsl:sort select="position()" data-type="number" order="descending"/>
                        </xsl:apply-templates>
                    </table>
                </div>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="entry">
        <tr>
            <td width="20%" class="toolSectionTitle" style="padding-left: 5px"><xsl:value-of select="@date"/></td>
            <td style="padding-right: 5px">
                <xsl:attribute name="class"><xsl:value-of select="@severity"/>Severity</xsl:attribute>
                <xsl:apply-templates/>
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="epc_error">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <xsl:for-each select="error">
                <tr class="errorSeverity" >
                    <td width="30%">
                        <xsl:if test="position()!=last()">
                            <xsl:attribute name="style">border-bottom: thin solid grey;</xsl:attribute>
                        </xsl:if>
                        EPC Error (<xsl:value-of select="@err_code"/>):<pre><xsl:value-of select="text()"/></pre>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>

    <xsl:template match="epc_output">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <xsl:if test="count(output)=0">
                No output generated.
            </xsl:if>
            <xsl:for-each select="output[@display!='hidden']">
                <tr class="warningSeverity">
                    <td width="30%">
                        <xsl:if test="position()!=last()"><xsl:attribute name="style">border-bottom: thin solid grey;</xsl:attribute></xsl:if>
                        <xsl:value-of select="@label"/>
                    </td>
                    <td align="right">
                        <xsl:if test="position()!=last()"><xsl:attribute name="style">border-bottom: thin solid grey;</xsl:attribute></xsl:if>
                        <xsl:choose>
                            <xsl:when test="@display='---'">
                                ---
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="value/text()"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>
